import {Component, OnInit} from '@angular/core';
import {BladeService} from '../../../shared/blade.service';
import {Blade} from '../../../shared/blade/blade.model';
import {BladeData} from '../../../shared/blade/blade-data';
import {Observable} from 'rxjs/Observable';
import {ModuleCodeListComponent} from './module-code-list/module-code-list.component';

@Component({
  selector: 'app-module-code',
  templateUrl: './module-code.component.html',
  styleUrls: ['./module-code.component.css'],
  providers: [BladeService]
})
export class ModuleCodeComponent implements OnInit {

  /**
   * 当前弹出层
   *
   * @type {Blade}
   * @memberof BladeContainerInterface
   */
  currentBlade: Blade;

  constructor(
    public bladeService: BladeService,
  ) {

  }

  ngOnInit() {
    this.createModuleListBlade()
  }


  /**
   * 创建风机状态列表弹出层
   *
   *
   * @memberof DicComponent
   */
  createModuleListBlade() {
    let data: BladeData = new BladeData();
    data.id = 'ModuleList';
    data.title = 'KR分类管理';
    data.subtitle = '分类管理';
    data.isClosingDisabled = true;
    this.currentBlade = this.bladeService.createBlade(ModuleCodeListComponent, data);
    this.bladeService.showBlade(this.currentBlade);
  }

  /**
   * 是否可以离开
   *
   *
   * @memberof DicComponent
   */
  canDeactivate(): boolean | Observable<boolean> | Promise<boolean> {
    return true;
  }
}
